package com.yang.springcloud.controller;

import com.yang.springcloud.pojo.Member;
import com.yang.springcloud.pojo.Student;
import com.yang.springcloud.service.MenberClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class MemberConsumerController {

    @Autowired
    private MenberClientService mcs;

    @PostMapping("/consumer/member/insert")
    public Map<String, Object> addMember(@RequestParam(name = "name") String name, @RequestParam(name = "info") String info){
        System.out.println(name);
        return mcs.insertMemberInfo(info);
    }

    @GetMapping("/consumer/member/query")
    public List<Member> queryMember(){
        return mcs.queryMemberAll();

    }

    @GetMapping("/consumer/member/queryById/{passid}")
    public Student queryById(@PathVariable("passid") String passid) {
        return mcs.queryById(passid);
    }
}
